var isNullregExp = /^\s*$/;
function add(obj){
		 
	var candidateName = jQuery("#candidateName");
	 
	var registrationDate = jQuery("#registrationDate"); 
	 
	var reason = jQuery("#reason");
	
	if (chackNullValue([candidateName,registrationDate,reason])) {
		return false;
	};
	
	var complay = jQuery("#complay").val();
	var dept = jQuery("#dept").val();
	var position = jQuery("#position").val();
	var status = jQuery("#status").val();
	var remark = jQuery("#remark").val();
	var dtoId = jQuery("#dtoId").val();
	var paraments = {
		'dto.complay.id':complay,
		'dto.department.id':dept,
		'dto.registrationDate':registrationDate.val(),
		'dto.position.id':position,
		'dto.status':status,
		'dto.reason':reason.val(),
		'dto.remark':remark,
		'dto.candidateName':candidateName.val(),
		'dto.id':(dtoId || "")
	};
var btnSave = jQuery("#btn_save").attr("disabled","true");
	jQuery.post(obj.action+"?time="+new Date().getTime(),paraments,function (args) {
		btnSave.removeAttr("disabled");
		eval("args="+args);
		if(args.result){
			alert(args.mess);
		} else {
			alert("保存成功！");
		}
	});
	return false;	
}

function chackNullValue(args){
	for (var i = 0; i < args.length; i++){
		var obj = args[i];
		if (isNullregExp.test(obj.val())) { 
			alert("带红色的* 为必填项!");
			obj.select();
			return true;
	 };
	};
	return false;
}
